package bsc.war.mail;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.servlet.ServletContext;

public class MailConsumer {

    public String getFileContent(ServletContext servletContext, String fileName){
        InputStream inp = servletContext.getResourceAsStream(fileName);
        StringBuilder sb = new StringBuilder();
        String line;
        try {
                BufferedReader reader = new BufferedReader(new InputStreamReader(inp, "ISO-8859-1"));
                while ((line = reader.readLine()) != null) {
                    sb.append(line);
                }
                inp.close();
                
            } catch(IOException ioex){ioex.printStackTrace();}
            return sb.toString();
    }

    public String getType() {
        return "text/html";
    }
}
